package com.lee.controller;

import com.github.pagehelper.PageInfo;
import com.lee.bean.Student;
import com.lee.service.StudentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by dllo on 18/4/16.
 */
@Controller
public class StudentController {
    @Resource
    private StudentService studentService;

    @RequestMapping(value = "studentlist")
    public String login(){
        return "student/listStudent";
    }

    @RequestMapping(value = "studentpage")
    @ResponseBody
    public PageInfo<Student> studentByPage(HttpServletRequest request,@RequestParam(value = "pageNo",required = false)Integer pageNo,//当前页
                                           @RequestParam(value = "pageSize",required = false)Integer pageSize){
        PageInfo<Student> pageInfo = studentService.queryStudentByPage(pageNo,3);
        return pageInfo;
    }
}
